package com.mvvm.base.base

import com.google.gson.JsonSyntaxException
import java.net.ConnectException
import java.net.SocketTimeoutException
import java.net.UnknownHostException


object ExceptionHandle {
     fun handleException(e: Throwable): String? {
        return if (e is SocketTimeoutException) {
            "连接超时"
        } else if (e is ConnectException || e is UnknownHostException) {
            "小主，您的手机网络不太顺畅哦~"
        } else if (e is JsonSyntaxException) {
            "解析数据出错了"
        } else {
            "出错了"
        }
    }

}